package ru.passivemoney.strategy.processors;

import java.util.HashSet;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.passivemoney.indicator.AIndicator;
import ru.passivemoney.indicator.CommonParameters;
import ru.passivemoney.indicator.IndicatorSpecParams;
import ru.passivemoney.indicator.ac.ACSpecParams;
import ru.passivemoney.indicator.ac.iAC;
import ru.passivemoney.strategy.Prognosis;

import com.dukascopy.api.IBar;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.OfferSide;
import com.dukascopy.api.Period;

public class ProcessorIAC implements IProcessor {

	private static final Logger logger = LoggerFactory.getLogger(ProcessorIAC.class);

	private Set<AIndicator> indicators = new HashSet<AIndicator>();
	private boolean inited = false;
	
	{
		logger.info("Creating common parameters for indicators...");
        CommonParameters commonParameters = new CommonParameters();
        commonParameters.setAppliedPrice(AppliedPrice.OPEN);
        commonParameters.setOfferSide(OfferSide.ASK);
        commonParameters.setPeriod(Period.ONE_MIN);
        logger.info(commonParameters.toString());
        
        logger.info("Creating specific parameters for indicators...");
        IndicatorSpecParams acSpecParams = new ACSpecParams();
        logger.info(acSpecParams.toString());
        
        logger.info("Creating indicators...");
        indicators.add(new iAC(commonParameters, acSpecParams));
        logger.info("AC indicator created with previously defined common & specific parameters");
	}
	
	@Override
	public Prognosis processBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) {
		if(!inited) init();
		return null;
	}

	public Set<AIndicator> getIndicators() {
		return indicators;
	}

	public void setIndicators(Set<AIndicator> indicators) {
		this.indicators = indicators;
	}

	@Override
	public void init() {
	}

}
